home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 2 code / Using C++ objects.sea / Using C++ objects / PtrObject.cp next >
MacBinary  |  1990-08-23  |  3.6 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Thu Aug 23 15:12:44 1990, modified Thu Aug 23 15:12:44 1990, creator 'MPS ', type ASCII, 2945 bytes "PtrObject.cp" , at 0xc01 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 50 74 72 4f 62 6a | 65 63 74 2e 63 70 00 00 |..PtrObj|ect.cp..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 0b 81 00 | 00 01 ac a2 f9 db 2c a2 |........|......,.|
|00000060| f9 db 2c 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..,.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 87 f7 00 00 |........|........|
|00000080| 2f 2f 20 50 74 72 4f 62 | 6a 65 63 74 2e 63 70 0d |// PtrOb|ject.cp.|
|00000090| 23 69 6e 63 6c 75 64 65 | 20 3c 4d 65 6d 6f 72 79 |#include| <Memory|
|000000a0| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 45 72 |.h>.#inc|lude <Er|
|000000b0| 72 6f 72 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |rors.h>.|#include|
|000000c0| 20 3c 73 74 64 69 6f 2e | 68 3e 0d 23 69 6e 63 6c | <stdio.|h>.#incl|
|000000d0| 75 64 65 20 3c 73 74 64 | 64 65 66 2e 68 3e 0d 0d |ude <std|def.h>..|
|000000e0| 23 69 6e 63 6c 75 64 65 | 20 22 50 74 72 4f 62 6a |#include| "PtrObj|
|000000f0| 65 63 74 2e 68 22 0d 0d | 2f 2f 20 53 74 61 74 69 |ect.h"..|// Stati|
|00000100| 63 20 64 61 74 61 20 6d | 65 6d 62 65 72 73 20 61 |c data m|embers a|
|00000110| 63 74 75 61 6c 6c 79 20 | 6e 65 65 64 20 74 6f 20 |ctually |need to |
|00000120| 62 65 20 64 65 63 6c 61 | 72 65 64 20 6f 75 74 73 |be decla|red outs|
|00000130| 69 64 65 20 6f 66 20 74 | 68 65 20 63 6c 61 73 73 |ide of t|he class|
|00000140| 20 64 65 66 69 6e 69 74 | 69 6f 6e 20 69 6e 0d 2f | definit|ion in./|
|00000150| 2f 20 6f 72 64 65 72 20 | 74 6f 20 68 61 76 65 20 |/ order |to have |
|00000160| 73 70 61 63 65 20 61 6c | 6c 6f 63 61 74 65 64 2e |space al|located.|
|00000170| 0d 54 48 7a 20 50 74 72 | 4f 62 6a 65 63 74 3a 3a |.THz Ptr|Object::|
|00000180| 66 5a 6f 6e 65 20 3d 20 | 6e 69 6c 3b 0d 0d 0d 4f |fZone = |nil;...O|
|00000190| 53 45 72 72 20 50 74 72 | 4f 62 6a 65 63 74 3a 3a |SErr Ptr|Object::|
|000001a0| 41 6c 6c 6f 63 48 65 61 | 70 28 73 69 7a 65 5f 74 |AllocHea|p(size_t|
|000001b0| 20 68 65 61 70 53 69 7a | 65 29 0d 7b 0d 09 2f 2f | heapSiz|e).{..//|
|000001c0| 20 42 79 20 64 65 66 61 | 75 6c 74 2c 20 74 68 65 | By defa|ult, the|
|000001d0| 20 68 65 61 70 20 67 65 | 74 73 20 6b 4e 75 6d 44 | heap ge|ts kNumD|
|000001e0| 66 6c 74 4d 61 73 74 65 | 72 73 20 6d 61 73 74 65 |fltMaste|rs maste|
|000001f0| 72 20 70 6f 69 6e 74 65 | 72 73 2e 20 41 20 73 6d |r pointe|rs. A sm|
|00000200| 61 6c 6c 20 6e 75 6d 62 | 65 72 2c 20 62 75 74 20 |all numb|er, but |
|00000210| 69 74 20 0d 09 2f 2f 20 | 73 68 6f 75 6c 64 6e d5 |it ..// |shouldn.|
|00000220| 74 20 6d 61 74 74 65 72 | 2c 20 73 69 6e 63 65 20 |t matter|, since |
|00000230| 77 65 20 77 69 6c 6c 20 | 6f 6e 6c 79 20 62 65 20 |we will |only be |
|00000240| 61 6c 6c 6f 63 61 74 69 | 6e 67 20 50 74 72 73 20 |allocati|ng Ptrs |
|00000250| 69 6e 20 74 68 69 73 20 | 68 65 61 70 2c 20 61 6e |in this |heap, an|
|00000260| 64 20 50 74 72 73 0d 09 | 2f 2f 20 64 6f 6e d5 74 |d Ptrs..|// don.t|
|00000270| 20 75 73 65 20 6d 61 73 | 74 65 72 20 70 6f 69 6e | use mas|ter poin|
|00000280| 74 65 72 73 2e 20 0d 09 | 63 6f 6e 73 74 20 73 68 |ters. ..|const sh|
|00000290| 6f 72 74 20 6b 4e 75 6d | 44 66 6c 74 4d 61 73 74 |ort kNum|DfltMast|
|000002a0| 65 72 73 20 3d 20 31 36 | 3b 0d 0d 09 2f 2f 20 54 |ers = 16|;...// T|
|000002b0| 68 69 73 20 6d 61 67 69 | 63 20 6e 75 6d 62 65 72 |his magi|c number|
|000002c0| 20 66 72 6f 6d 20 49 6e | 73 69 64 65 20 4d 61 63 | from In|side Mac|
|000002d0| 2c 20 76 6f 6c 2e 20 49 | 49 2c 20 63 68 61 70 74 |, vol. I|I, chapt|
|000002e0| 65 72 20 31 2c 20 69 73 | 20 74 68 65 20 61 6d 6f |er 1, is| the amo|
|000002f0| 75 6e 74 20 6f 66 20 73 | 70 61 63 65 0d 09 2f 2f |unt of s|pace..//|
|00000300| 20 72 65 71 75 69 72 65 | 64 20 66 6f 72 20 74 68 | require|d for th|
|00000310| 65 20 7a 6f 6e 65 20 68 | 65 61 64 65 72 20 61 6e |e zone h|eader an|
|00000320| 64 20 74 72 61 69 6c 65 | 72 2c 20 61 6e 64 20 74 |d traile|r, and t|
|00000330| 68 65 20 6d 61 73 74 65 | 72 20 70 6f 69 6e 74 65 |he maste|r pointe|
|00000340| 72 20 62 6c 6f 63 6b 2e | 20 57 65 20 61 64 64 20 |r block.| We add |
|00000350| 74 68 69 73 0d 09 2f 2f | 20 74 6f 20 74 68 65 20 |this..//| to the |
|00000360| 72 65 71 75 65 73 74 65 | 64 20 68 65 61 70 20 73 |requeste|d heap s|
|00000370| 69 7a 65 20 74 6f 20 63 | 6f 6d 70 65 6e 73 61 74 |ize to c|ompensat|
|00000380| 65 2e 0d 09 63 6f 6e 73 | 74 20 73 69 7a 65 5f 74 |e...cons|t size_t|
|00000390| 20 6b 5a 6f 6e 65 4f 76 | 65 72 68 65 61 64 20 3d | kZoneOv|erhead =|
|000003a0| 20 36 34 20 2b 20 38 20 | 2b 20 28 73 69 7a 65 6f | 64 + 8 |+ (sizeo|
|000003b0| 66 28 6c 6f 6e 67 29 20 | 2a 20 6b 4e 75 6d 44 66 |f(long) |* kNumDf|
|000003c0| 6c 74 4d 61 73 74 65 72 | 73 29 3b 0d 0d 09 68 65 |ltMaster|s);...he|
|000003d0| 61 70 53 69 7a 65 20 2b | 3d 20 6b 5a 6f 6e 65 4f |apSize +|= kZoneO|
|000003e0| 76 65 72 68 65 61 64 3b | 09 09 2f 2f 20 46 61 63 |verhead;|..// Fac|
|000003f0| 74 6f 72 20 69 6e 20 6f | 76 65 72 68 65 61 64 2e |tor in o|verhead.|
|00000400| 0d 0d 09 2f 2f 20 41 6c | 6c 6f 63 61 74 65 20 73 |...// Al|locate s|
|00000410| 70 61 63 65 20 66 6f 72 | 20 74 68 65 20 7a 6f 6e |pace for| the zon|
|00000420| 65 2e 0d 09 50 74 72 20 | 7a 6f 6e 65 50 74 72 20 |e...Ptr |zonePtr |
|00000430| 3d 20 4e 65 77 50 74 72 | 28 68 65 61 70 53 69 7a |= NewPtr|(heapSiz|
|00000440| 65 29 3b 09 0d 09 69 66 | 20 28 21 7a 6f 6e 65 50 |e);...if| (!zoneP|
|00000450| 74 72 29 09 09 09 09 09 | 2f 2f 20 69 66 20 61 6c |tr).....|// if al|
|00000460| 6c 6f 63 20 66 61 69 6c | 73 2c 20 72 65 74 75 72 |loc fail|s, retur|
|00000470| 6e 20 65 72 72 6f 72 0d | 09 20 20 72 65 74 75 72 |n error.|. retur|
|00000480| 6e 20 4d 65 6d 45 72 72 | 6f 72 28 29 3b 09 09 09 |n MemErr|or();...|
|00000490| 2f 2f 20 47 65 74 20 61 | 20 70 6f 69 6e 74 65 72 |// Get a| pointer|
|000004a0| 20 74 6f 20 74 68 65 20 | 65 6e 64 20 6f 66 20 74 | to the |end of t|
|000004b0| 68 65 20 68 65 61 70 2e | 0d 0d 09 50 74 72 20 6c |he heap.|...Ptr l|
|000004c0| 69 6d 69 74 50 74 72 20 | 3d 20 28 50 74 72 29 20 |imitPtr |= (Ptr) |
|000004d0| 28 28 28 70 74 72 64 69 | 66 66 5f 74 29 20 7a 6f |(((ptrdi|ff_t) zo|
|000004e0| 6e 65 50 74 72 29 20 2b | 20 68 65 61 70 53 69 7a |nePtr) +| heapSiz|
|000004f0| 65 29 3b 0d 0d 09 2f 2f | 20 49 6e 69 74 69 61 6c |e);...//| Initial|
|00000500| 69 7a 65 20 74 68 65 20 | 7a 6f 6e 65 2e 0d 09 54 |ize the |zone...T|
|00000510| 48 7a 20 20 73 61 76 65 | 64 5a 6f 6e 65 20 3d 20 |Hz save|dZone = |
|00000520| 47 65 74 5a 6f 6e 65 28 | 29 3b 0d 09 49 6e 69 74 |GetZone(|);..Init|
|00000530| 5a 6f 6e 65 28 6e 69 6c | 2c 20 6b 4e 75 6d 44 66 |Zone(nil|, kNumDf|
|00000540| 6c 74 4d 61 73 74 65 72 | 73 2c 20 6c 69 6d 69 74 |ltMaster|s, limit|
|00000550| 50 74 72 2c 20 7a 6f 6e | 65 50 74 72 29 3b 0d 09 |Ptr, zon|ePtr);..|
|00000560| 53 65 74 5a 6f 6e 65 28 | 73 61 76 65 64 5a 6f 6e |SetZone(|savedZon|
|00000570| 65 29 3b 0d 0d 09 2f 2f | 20 53 61 76 65 20 74 68 |e);...//| Save th|
|00000580| 65 20 7a 6f 6e 65 20 70 | 6f 69 6e 74 65 72 20 69 |e zone p|ointer i|
|00000590| 6e 20 6f 75 72 20 73 74 | 61 74 69 63 20 63 6c 61 |n our st|atic cla|
|000005a0| 73 73 20 76 61 72 69 61 | 62 6c 65 2e 0d 09 66 5a |ss varia|ble...fZ|
|000005b0| 6f 6e 65 20 3d 20 28 54 | 48 7a 29 20 7a 6f 6e 65 |one = (T|Hz) zone|
|000005c0| 50 74 72 3b 0d 09 72 65 | 74 75 72 6e 20 6e 6f 45 |Ptr;..re|turn noE|
|000005d0| 72 72 3b 0d 7d 0d 0d 76 | 6f 69 64 20 50 74 72 4f |rr;.}..v|oid PtrO|
|000005e0| 62 6a 65 63 74 3a 3a 44 | 69 73 70 6f 73 65 48 65 |bject::D|isposeHe|
|000005f0| 61 70 28 29 0d 7b 0d 09 | 2f 2f 20 49 66 20 7a 6f |ap().{..|// If zo|
|00000600| 6e 65 20 61 63 74 75 61 | 6c 6c 79 20 65 78 69 73 |ne actua|lly exis|
|00000610| 74 73 2c 20 64 69 73 70 | 6f 73 65 20 6f 66 20 69 |ts, disp|ose of i|
|00000620| 74 2e 0d 09 69 66 20 28 | 66 5a 6f 6e 65 29 0d 09 |t...if (|fZone)..|
|00000630| 20 20 7b 0d 09 09 44 69 | 73 70 6f 73 50 74 72 28 | {...Di|sposPtr(|
|00000640| 28 50 74 72 29 20 66 5a | 6f 6e 65 29 3b 0d 09 09 |(Ptr) fZ|one);...|
|00000650| 66 5a 6f 6e 65 20 3d 20 | 6e 69 6c 3b 0d 09 20 20 |fZone = |nil;.. |
|00000660| 7d 0d 7d 0d 0d 6c 6f 6e | 67 20 50 74 72 4f 62 6a |}.}..lon|g PtrObj|
|00000670| 65 63 74 3a 3a 46 72 65 | 65 4d 65 6d 6f 72 79 28 |ect::Fre|eMemory(|
|00000680| 29 0d 7b 0d 09 54 48 7a | 20 73 61 76 65 64 5a 6f |).{..THz| savedZo|
|00000690| 6e 65 3b 0d 0d 09 2f 2f | 20 42 65 66 6f 72 65 20 |ne;...//| Before |
|000006a0| 77 65 20 63 61 6e 20 72 | 65 74 75 72 6e 20 74 68 |we can r|eturn th|
|000006b0| 65 20 61 6d 6f 75 6e 74 | 20 6f 66 20 66 72 65 65 |e amount| of free|
|000006c0| 20 6d 65 6d 6f 72 79 2c | 20 77 65 0d 09 2f 2f 20 | memory,| we..// |
|000006d0| 6e 65 65 64 20 74 6f 20 | 73 77 69 74 63 68 20 74 |need to |switch t|
|000006e0| 6f 20 74 68 65 20 63 6f | 72 72 65 63 74 20 7a 6f |o the co|rrect zo|
|000006f0| 6e 65 2e 0d 09 69 66 20 | 28 66 5a 6f 6e 65 29 0d |ne...if |(fZone).|
|00000700| 09 20 20 7b 0d 09 09 73 | 61 76 65 64 5a 6f 6e 65 |. {...s|avedZone|
|00000710| 20 3d 20 47 65 74 5a 6f | 6e 65 28 29 3b 09 09 2f | = GetZo|ne();../|
|00000720| 2f 20 53 61 76 65 20 63 | 75 72 72 65 6e 74 20 7a |/ Save c|urrent z|
|00000730| 6f 6e 65 2e 0d 09 09 53 | 65 74 5a 6f 6e 65 28 66 |one....S|etZone(f|
|00000740| 5a 6f 6e 65 29 3b 09 09 | 09 09 2f 2f 20 4d 61 6b |Zone);..|..// Mak|
|00000750| 65 20 6f 75 72 20 7a 6f | 6e 65 20 63 75 72 72 65 |e our zo|ne curre|
|00000760| 6e 74 2e 0d 09 20 20 7d | 0d 0d 09 6c 6f 6e 67 20 |nt... }|...long |
|00000770| 66 72 65 65 20 3d 20 46 | 72 65 65 4d 65 6d 28 29 |free = F|reeMem()|
|00000780| 3b 09 09 09 2f 2f 20 47 | 65 74 20 74 6f 74 61 6c |;...// G|et total|
|00000790| 20 66 72 65 65 20 73 70 | 61 63 65 2e 0d 0d 09 69 | free sp|ace....i|
|000007a0| 66 20 28 66 5a 6f 6e 65 | 29 0d 09 20 20 53 65 74 |f (fZone|).. Set|
|000007b0| 5a 6f 6e 65 28 73 61 76 | 65 64 5a 6f 6e 65 29 3b |Zone(sav|edZone);|
|000007c0| 09 09 09 2f 2f 20 52 65 | 73 74 6f 72 65 20 70 72 |...// Re|store pr|
|000007d0| 65 76 69 6f 75 73 20 7a | 6f 6e 65 2e 0d 0d 09 72 |evious z|one....r|
|000007e0| 65 74 75 72 6e 20 66 72 | 65 65 3b 0d 7d 0d 0d 53 |eturn fr|ee;.}..S|
|000007f0| 69 7a 65 20 50 74 72 4f | 62 6a 65 63 74 3a 3a 4d |ize PtrO|bject::M|
|00000800| 61 78 4d 65 6d 6f 72 79 | 28 29 0d 7b 0d 09 54 48 |axMemory|().{..TH|
|00000810| 7a 20 73 61 76 65 64 5a | 6f 6e 65 3b 0d 09 0d 09 |z savedZ|one;....|
|00000820| 2f 2f 20 42 65 66 6f 72 | 65 20 77 65 20 63 61 6e |// Befor|e we can|
|00000830| 20 72 65 74 75 72 6e 20 | 74 68 65 20 6d 61 78 69 | return |the maxi|
|00000840| 6d 75 6d 20 62 6c 6f 63 | 6b 20 73 69 7a 65 2c 20 |mum bloc|k size, |
|00000850| 77 65 20 6e 65 65 64 0d | 09 2f 2f 20 74 6f 20 73 |we need.|.// to s|
|00000860| 77 69 74 63 68 20 74 6f | 20 74 68 65 20 63 6f 72 |witch to| the cor|
|00000870| 72 65 63 74 20 7a 6f 6e | 65 2e 0d 09 69 66 20 28 |rect zon|e...if (|
|00000880| 66 5a 6f 6e 65 29 0d 09 | 20 20 7b 0d 09 09 73 61 |fZone)..| {...sa|
|00000890| 76 65 64 5a 6f 6e 65 20 | 3d 20 47 65 74 5a 6f 6e |vedZone |= GetZon|
|000008a0| 65 28 29 3b 09 09 2f 2f | 20 53 61 76 65 20 63 75 |e();..//| Save cu|
|000008b0| 72 72 65 6e 74 20 7a 6f | 6e 65 2e 0d 09 09 53 65 |rrent zo|ne....Se|
|000008c0| 74 5a 6f 6e 65 28 66 5a | 6f 6e 65 29 3b 09 09 09 |tZone(fZ|one);...|
|000008d0| 09 2f 2f 20 4d 61 6b 65 | 20 6f 75 72 20 7a 6f 6e |.// Make| our zon|
|000008e0| 65 20 63 75 72 72 65 6e | 74 2e 0d 09 20 20 7d 0d |e curren|t... }.|
|000008f0| 0d 09 2f 2f 20 57 65 20 | 6b 6e 6f 77 20 74 68 65 |..// We |know the|
|00000900| 20 68 65 61 70 20 63 61 | 6e d5 74 20 67 72 6f 77 | heap ca|n.t grow|
|00000910| 2c 20 62 75 74 20 77 65 | 20 68 61 76 65 20 74 6f |, but we| have to|
|00000920| 20 68 61 76 65 20 61 20 | 74 65 6d 70 0d 09 2f 2f | have a |temp..//|
|00000930| 20 76 61 72 69 61 62 6c | 65 20 74 6f 20 73 61 74 | variabl|e to sat|
|00000940| 69 73 66 79 20 74 68 65 | 20 54 6f 6f 6c 62 6f 78 |isfy the| Toolbox|
|00000950| 2e 0d 09 53 69 7a 65 20 | 74 53 69 7a 65 3b 0d 0d |...Size |tSize;..|
|00000960| 09 53 69 7a 65 20 6d 61 | 78 20 3d 20 4d 61 78 4d |.Size ma|x = MaxM|
|00000970| 65 6d 28 26 74 53 69 7a | 65 29 3b 09 09 2f 2f 20 |em(&tSiz|e);..// |
|00000980| 47 65 74 20 73 69 7a 65 | 20 6f 66 20 62 69 67 67 |Get size| of bigg|
|00000990| 65 73 74 20 62 6c 6f 63 | 6b 2e 0d 0d 09 69 66 20 |est bloc|k....if |
|000009a0| 28 66 5a 6f 6e 65 29 0d | 09 20 20 53 65 74 5a 6f |(fZone).|. SetZo|
|000009b0| 6e 65 28 73 61 76 65 64 | 5a 6f 6e 65 29 3b 09 09 |ne(saved|Zone);..|
|000009c0| 09 2f 2f 20 52 65 73 74 | 6f 72 65 20 70 72 65 76 |.// Rest|ore prev|
|000009d0| 69 6f 75 73 20 7a 6f 6e | 65 2e 0d 0d 09 72 65 74 |ious zon|e....ret|
|000009e0| 75 72 6e 20 6d 61 78 3b | 0d 7d 0d 0d 76 6f 69 64 |urn max;|.}..void|
|000009f0| 2a 20 50 74 72 4f 62 6a | 65 63 74 3a 3a 6f 70 65 |* PtrObj|ect::ope|
|00000a00| 72 61 74 6f 72 20 6e 65 | 77 28 73 69 7a 65 5f 74 |rator ne|w(size_t|
|00000a10| 20 73 69 7a 65 29 0d 7b | 0d 09 54 48 7a 20 73 61 | size).{|..THz sa|
|00000a20| 76 65 64 5a 6f 6e 65 3b | 0d 0d 09 2f 2f 20 62 65 |vedZone;|...// be|
|00000a30| 66 6f 72 65 20 77 65 20 | 63 61 6e 20 61 6c 6c 6f |fore we |can allo|
|00000a40| 63 61 74 65 20 6d 65 6d | 6f 72 79 2c 20 77 65 20 |cate mem|ory, we |
|00000a50| 6e 65 65 64 0d 09 2f 2f | 20 74 6f 20 73 77 69 74 |need..//| to swit|
|00000a60| 63 68 20 74 6f 20 74 68 | 65 20 63 6f 72 72 65 63 |ch to th|e correc|
|00000a70| 74 20 7a 6f 6e 65 0d 09 | 69 66 20 28 66 5a 6f 6e |t zone..|if (fZon|
|00000a80| 65 29 0d 09 20 20 7b 0d | 09 09 73 61 76 65 64 5a |e).. {.|..savedZ|
|00000a90| 6f 6e 65 20 3d 20 47 65 | 74 5a 6f 6e 65 28 29 3b |one = Ge|tZone();|
|00000aa0| 09 2f 2f 20 53 61 76 65 | 20 63 75 72 72 65 6e 74 |.// Save| current|
|00000ab0| 20 7a 6f 6e 65 2e 0d 09 | 09 53 65 74 5a 6f 6e 65 | zone...|.SetZone|
|00000ac0| 28 66 5a 6f 6e 65 29 3b | 09 09 09 2f 2f 20 4d 61 |(fZone);|...// Ma|
|00000ad0| 6b 65 20 6f 75 72 20 7a | 6f 6e 65 20 63 75 72 72 |ke our z|one curr|
|00000ae0| 65 6e 74 2e 0d 09 20 20 | 7d 0d 0d 09 50 74 72 20 |ent... |}...Ptr |
|00000af0| 70 20 3d 20 4e 65 77 50 | 74 72 28 73 69 7a 65 29 |p = NewP|tr(size)|
|00000b00| 3b 09 09 2f 2f 20 41 6c | 6c 6f 63 61 74 65 20 6d |;..// Al|locate m|
|00000b10| 65 6d 6f 72 79 20 66 6f | 72 20 6f 62 6a 65 63 74 |emory fo|r object|
|00000b20| 2e 0d 0d 09 69 66 20 28 | 66 5a 6f 6e 65 29 0d 09 |....if (|fZone)..|
|00000b30| 53 65 74 5a 6f 6e 65 28 | 73 61 76 65 64 5a 6f 6e |SetZone(|savedZon|
|00000b40| 65 29 3b 09 09 09 2f 2f | 20 52 65 73 74 6f 72 65 |e);...//| Restore|
|00000b50| 20 70 72 65 76 69 6f 75 | 73 20 7a 6f 6e 65 2e 0d | previou|s zone..|
|00000b60| 0d 09 72 65 74 75 72 6e | 20 70 3b 0d 7d 0d 0d 76 |..return| p;.}..v|
|00000b70| 6f 69 64 20 50 74 72 4f | 62 6a 65 63 74 3a 3a 6f |oid PtrO|bject::o|
|00000b80| 70 65 72 61 74 6f 72 20 | 64 65 6c 65 74 65 28 76 |perator |delete(v|
|00000b90| 6f 69 64 2a 20 70 29 0d | 7b 0d 09 44 69 73 70 6f |oid* p).|{..Dispo|
|00000ba0| 73 50 74 72 28 28 50 74 | 72 29 20 70 29 3b 09 09 |sPtr((Pt|r) p);..|
|00000bb0| 09 2f 2f 20 54 68 69 73 | 20 77 6f 72 6b 73 20 72 |.// This| works r|
|00000bc0| 65 67 61 72 64 6c 65 73 | 73 20 6f 66 20 74 68 65 |egardles|s of the|
|00000bd0| 20 7a 6f 6e 65 0d 09 09 | 09 09 09 09 09 09 2f 2f | zone...|......//|
|00000be0| 20 74 68 65 20 70 6f 69 | 6e 74 65 72 20 77 61 73 | the poi|nter was|
|00000bf0| 20 61 6c 6c 6f 63 61 74 | 65 64 20 69 6e 2e 0d 7d | allocat|ed in..}|
|00000c00| 0d 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c10| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000c80| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00000c90| 09 53 65 74 5a 6f 6e 65 | 28 66 5a 6f 6e 65 29 3b |.SetZone|(fZone);|
|00000ca0| 09 09 2f 2f 20 4d 61 6b | 65 20 6f 75 72 20 7a 6f |..// Mak|e our zo|
|00000cb0| 0c 50 74 72 4f 62 6a 65 | 63 74 2e 63 70 1b 02 00 |.PtrObje|ct.cp...|
|00000cc0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 00 00 00 |..TEXTMP|S ......|
|00000cd0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 00 00 00 00 |..TEXTMP|S ......|
|00000ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000cf0| 00 00 a2 ec 58 62 00 00 | 0b 81 00 00 01 ac 5a 6f |....Xb..|......Zo|
|00000d00| 6e 65 29 0d 09 20 53 65 | 74 5a 6f 6e 65 28 73 61 |ne).. Se|tZone(sa|
|00000d10| 76 65 64 5a 6f 6e 65 29 | 3b 09 09 09 2f 2f 20 52 |vedZone)|;...// R|
|00000d20| 65 73 74 6f 72 65 20 70 | 72 65 76 69 6f 75 73 20 |estore p|revious |
|00000d30| 7a 6f 6e 65 2e 0d 09 72 | 65 74 75 72 6e 20 70 3b |zone...r|eturn p;|
|00000d40| 0d 7d 0d 0d 76 6f 69 64 | 20 50 74 72 4f 62 6a 65 |.}..void| PtrObje|
|00000d50| 63 74 3a 3a 6f 70 65 72 | 61 74 6f 72 20 64 65 6c |ct::oper|ator del|
|00000d60| 65 74 65 28 76 6f 69 64 | 2a 20 70 29 0d 09 44 69 |ete(void|* p)..Di|
|00000d70| 73 70 6f 73 50 74 72 28 | 28 50 74 72 29 20 70 29 |sposPtr(|(Ptr) p)|
|00000d80| 00 00 00 1e 00 54 01 5b | 03 63 04 26 00 54 01 5b |.....T.[|.c.&.T.[|
|00000d90| 03 63 04 26 00 00 00 00 | 00 00 00 00 00 00 00 00 |.c.&....|........|
|00000da0| 00 00 00 00 00 48 00 0c | 4d 6f 6e 61 63 6f 00 0b |.....H..|Monaco..|
|00000db0| 4e 65 77 20 57 69 6e 64 | 6f 77 3a 00 00 00 00 00 |New Wind|ow:.....|
|00000dc0| 00 1a 00 e3 00 2e 01 5b | 00 07 00 04 00 2a 00 03 |.......[|.....*..|
|00000dd0| 01 dd 02 7d 00 3c 00 24 | 01 d5 02 7a a2 f9 71 b4 |...}.<.$|...z..q.|
|00000de0| 00 00 04 f3 00 00 04 f3 | 00 00 04 3a 01 00 00 00 |........|...:....|
|00000df0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 2d |.....n..|.n...>.-|
|00000e00| 1b 5c 0b 64 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |.\.d....|.>..MPSR|
|00000e10| 00 01 00 0a 03 f0 ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00000e20| 03 ed ff ff 00 00 00 22 | 00 2e c2 f0 00 00 00 00 |......."|........|
|00000e30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000e70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+